#!/usr/bin/python
# -*- coding: utf-8 -*-
#-------------------------------------------------
#Create At: 2009-2-23 下午09:23:53 
#Create By: Fla.sam
#
#DESC:  u6u8 setting
#
#-------------------------------------------------

# Django settings for project project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

import os.path
import sys

# MAIN_ROOT_PATH  -> project/../
MAIN_ROOT = os.path.normpath( os.path.join( os.path.dirname( __file__ ), '../' ) )

#PROJECT_ROOT - > prject/
PROJECT_ROOT = os.path.normpath( os.path.dirname( __file__ ) )

#insert external app or lib path
sys.path.insert( 0, os.path.join( PROJECT_ROOT, "pure_admin" ) )
sys.path.insert( 0, os.path.join( PROJECT_ROOT, "apps" ) )
sys.path.insert( 0, os.path.join( PROJECT_ROOT, "ext_apps" ) )

ADMINS = ( 
    ( 'fla', 'fla.sam@gmail.com' ),
 )

MANAGERS = ADMINS

#DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
#DATABASE_NAME = os.path.join( PROJECT_ROOT, 'dev_db.sqlite' )             # Or path to database file if using sqlite3.
#DATABASE_USER = ''             # Not used with sqlite3.
#DATABASE_PASSWORD = ''         # Not used with sqlite3.
#DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
#DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.

DATABASE_ENGINE = 'mysql'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'django_pureftpd'             # Or path to database file if using sqlite3.
DATABASE_USER = 'django'             # Not used with sqlite3.
DATABASE_PASSWORD = 's13c241122'         # Not used with sqlite3.
DATABASE_HOST = '127.0.0.1'             # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '3306'             # Set to empty string for default. Not used with sqlite3.

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = '+8'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'zh-cn'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = os.path.join( PROJECT_ROOT, "static-medias" )

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '/static-medias/'

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/admin-medias/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = '+m%&p)luz676)&yz4r6o#gv&i8*(89^oh82szdb$zfo0tmfk5d'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = ( 
    'django.template.loaders.filesystem.load_template_source',
    'django.template.loaders.app_directories.load_template_source',
 )

TEMPLATE_CONTEXT_PROCESSORS = ( 
                               "django.core.context_processors.auth",
                               "django.core.context_processors.debug",
                               "django.core.context_processors.i18n",
                               "django.core.context_processors.media",
                               "django.core.context_processors.request",
 )

MIDDLEWARE_CLASSES = ( 
                      'django.contrib.sessions.middleware.SessionMiddleware',
                      'django.middleware.common.CommonMiddleware',
                      'django.contrib.auth.middleware.AuthenticationMiddleware',
                      #'utils_app.middleware.threadlocals.ThreadLocals',
                      'django.middleware.http.ConditionalGetMiddleware',
                      'django.middleware.gzip.GZipMiddleware',
                      #'django.middleware.cache.CacheMiddleware',                   
                      'django.middleware.doc.XViewMiddleware',
                      'django.middleware.locale.LocaleMiddleware',
                      #'pagination.middleware.PaginationMiddleware',
                      #'maintenancemode.middleware.MaintenanceModeMiddleware', #临时关闭站点中间件
                      #'debug_toolbar.middleware.DebugToolbarMiddleware', #the Debug Toolbar middleware must come after any other middleware that encodes the response's content (such as GZipMiddleware).
 )

ROOT_URLCONF = 'urls'

TEMPLATE_DIRS = ( 
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join( PROJECT_ROOT, "templates" ), \
    os.path.join( PROJECT_ROOT, "templatetags" ), \
 )

INSTALLED_APPS = ( 
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    #'django.contrib.sites',
    #'django.contrib.flatpages',
    #'django.contrib.comments',
    'django.contrib.humanize',
    'django.contrib.markup',
    
    'uni_form',
    
    #添加 project 为一个基本 app,装载templatetags. 该 app,不创建 models. views
    'pure_admin',
    'core_app',
    
    # load django admin app
    'django.contrib.admin',
    'django.contrib.admindocs',
 )

#站点cache
#CACHE_BACKEND = 'locmem:///?timeout=7200&max_entries=40000&cull_frequency=3'
#CACHE_BACKEND = 'memcached://127.0.0.1:11211/?timeout=7200&max_entries=40000&cull_frequency=3'
#CACHE_MIDDLEWARE_SECONDS = 30
#CACHE_MIDDLEWARE_KEY_PREFIX = 'xiyou'
#CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True

#user profile 设置
#===============================================================================
# AUTH_PROFILE_MODULE = 'profile_app.UserProfile'
# 
# ABSOLUTE_URL_OVERRIDES = {
#    "auth.user": lambda o: "/profile/%s/" % o.username,
# }
#===============================================================================

LOGIN_REDIRECT_URL = '/'

FORCE_SCRIPT_NAME = ''

FILE_SYSTEM_CODE = sys.getfilesystemencoding()
#FILE_SYSTEM_CODE = 'cp936'

#===============================================================================
# 设置FTP的信息
#===============================================================================
PURE_FTPD_ROOT_PATH = '/data/sdd1/ftpd'
PURE_FTPD_HOST_PORT = '192.168.10.20:21'
PURE_FTPD_README = '/data/sdd1/ftpd/public/README.txt'
PURE_FTPD_NEWS = '/data/sdd1/ftpd/public/NEWS.txt'

PURE_ADMIN_UID = 2000
PURE_TECHER_UID = 2001
PURE_STUDENT_UID = 2002

PURE_DEFAULT_UID = 33
PURE_DEFAULT_GID = 33

